Skip to content

feat: integrate vite devtools - #226

Closed
arashsheyda wants to merge 36 commits into
mainfrom
feat/vite-devtools-renderer
Closed

feat: integrate vite devtools#226
arashsheyda wants to merge 36 commits into
mainfrom
feat/vite-devtools-renderer

Conversation

@arashsheyda

@arashsheyda arashsheyda commented May 31, 2026

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

closes #9

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Adds Vite DevTools integration via the separate @comark/devtools package, and fixes the React <Comark> component for client-side environments.

Vite DevTools Integration

UI / RPC / host bridge live in @comark/devtools (not inside comark):

import { DevTools } from '@vitejs/devtools'
import comarkDevtools from '@comark/devtools/vite'

export default defineConfig({
  plugins: [DevTools(), comarkDevtools],
})
  • Vue: @comark/vue/vite soft-loads @comark/devtools/vite when installed — only need DevTools() + comark()
  • React / Svelte / HTML / Angular: add comarkDevtools manually (see examples)
  • Optional host bridge: import { connectDevtools } from '@comark/devtools/host-client'

This PR pins the pre-release via pkg.pr.new for development:

https://pkg.pr.new/comarkdown/comark-devtools/@comark/devtools@b168cd3

Other changes

While working on the devtools I found a bug with the React example while Vite DevTools was enabled:

App.tsx:13 <Comark> is an async Client Component. Only Server Components can be async at the moment.

The fix makes <Comark> no longer async so it works in both client and server contexts.

Screen.Recording.2026-05-31.at.1.00.26.AM.mov

📝 Checklist

  • I have linked an issue or discussion.
  • I have run pnpm verify and it passes.
  • I have updated the documentation accordingly.

@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comark Ready Ready Preview Jul 30, 2026 11:00am
comark-json-render Ready Ready Preview Jul 30, 2026 11:00am
comark-nextjs Ready Ready Preview Jul 30, 2026 11:00am
comark-nuxt Error Error Jul 30, 2026 11:00am
comark-svelte Ready Ready Preview Jul 30, 2026 11:00am
comark-sveltekit Ready Ready Preview Jul 30, 2026 11:00am
comark-twoslash Ready Ready Preview Jul 30, 2026 11:00am
comark-vue Ready Ready Preview Jul 30, 2026 11:00am

@atinux

atinux commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Amazing @arashsheyda

Now I would only keep Markdown & AST as tabs (not sure the others are useful)
CleanShot_2026-04-29_at_10 21 342x

So we have only one view
and the status (🟢 comark-2) on the far right of the tabs
And when having no-instance, displaying an empty state with "No or detected on the current page."

@arashsheyda

arashsheyda commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

@atinux working on the syntax highlighting rn! one thing that we changed (from the initial work) is comark-2 status is now shown as the page url. previously we were using the instance index but I thought showing the page url is better
Screenshot 2026-06-03 at 5 48 22 PM
Screenshot 2026-06-03 at 5 48 33 PM

@farnabaz

Copy link
Copy Markdown
Collaborator

@arashsheyda I moved Angular docs changes to #247 and merge original PR, feel free merge main into this PR and update for Angular.

@arashsheyda

Copy link
Copy Markdown
Collaborator Author

@farnabaz I've updated the PR and docs and I believe it should be ready for final review 🤩

@pkg-pr-new

pkg-pr-new Bot commented Jun 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

npm i https://pkg.pr.new/comarkdown/comark@226

@comark/angular

npm i https://pkg.pr.new/comarkdown/comark/@comark/angular@226

@comark/ansi

npm i https://pkg.pr.new/comarkdown/comark/@comark/ansi@226

@comark/html

npm i https://pkg.pr.new/comarkdown/comark/@comark/html@226

@comark/nuxt

npm i https://pkg.pr.new/comarkdown/comark/@comark/nuxt@226

@comark/react

npm i https://pkg.pr.new/comarkdown/comark/@comark/react@226

@comark/svelte

npm i https://pkg.pr.new/comarkdown/comark/@comark/svelte@226

@comark/vue

npm i https://pkg.pr.new/comarkdown/comark/@comark/vue@226

commit: d9905de

Comment thread packages/comark/package.json Outdated
".": "./dist/index.js",
"./vite": "./dist/devtools/vite.js",
"./devtools": "./dist/devtools/index.js",
"./devtools-renderer": "./dist/devtools/renderer/index.js",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"./devtools-renderer": "./dist/devtools/renderer/index.js",
"./devtools": "./dist/devtools/index.js",
"./devtools/*": "./dist/devtools/*.js"

The more I this, the more I come to this idea that we need to move vite export under dev tools.

I would like this:

/src/devtools
- index.ts (/devtools)
- vite.ts (/vite)
- renderer.ts (/renderer)
- uitls (reso of internal stuff)

Having simpler export al so allows use to re-export /devtool from other packages

    "./devtools": "./dist/devtools/index.js",
     "./devtools/*": "./dist/devtools/*.js"

Comment thread packages/comark/src/devtools/renderer/styles.ts Outdated
@arashsheyda

Copy link
Copy Markdown
Collaborator Author

@farnabaz would you mind do a final check ❤️

farnabaz added 7 commits July 28, 2026 17:13
Move Vite DevTools UI out of comark into @comark/devtools
(pkg.pr.new @b168cd3). Soft-load it from @comark/vue/vite and
point examples/docs at the external package.
@farnabaz

Copy link
Copy Markdown
Collaborator

@arashsheyda Thanks for the PR and your patient 🙂
I moved main logic to (commit) and invited you to repo. (we make it public after finalizing it)
We are going to release separate devtools package which makes maintaining easier and also does not increase bundle size of main package.

@arashsheyda

Copy link
Copy Markdown
Collaborator Author

oh cool! thanks. checking it out now

@arashsheyda

Copy link
Copy Markdown
Collaborator Author

I just tested it out, looks awesome!

@farnabaz

Copy link
Copy Markdown
Collaborator

@arashsheyda Oh did you close this PR? We still need it for changes inside components.

@arashsheyda

Copy link
Copy Markdown
Collaborator Author

oh shoot yes. I'll open another one sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: devtools tab for nuxt integration

3 participants